import Vue from "vue";
import VueRouter from "vue-router";
import Home from "../views/home/Home.vue";
import Login from "../views/Login.vue";

Vue.use(VueRouter);

const routes = [
  // 主页
  {
    path: "/",
    component: Home,
    children: [
      // 首页
      {
        path: "",
        component: () => import("../views/home/index"),
      },
      // 问答页
      { path: "/qaa", component: () => import("../views/home/qAa/qAa") },
      // 视频页
      { path: "/video", component: () => import("../views/home/video/video") },
      // 我的页
      { path: "/my", component: () => import("../views/home/my/my") },
    ],
  },
  // 频道编辑页
  {
    path: "/channelEdit",
    component: () => import("../views/home/channelEdit"),
  },
  // 新闻详情页
  {
    path: "/content",
    component: () => import("../views/home/index/content"),
  },
  // 登录页
  {
    path: "/login",
    component: Login,
  },
];

const router = new VueRouter({
  mode: "history",
  base: process.env.BASE_URL,
  routes,
});

export default router;
